<?php

class Pre_model extends CI_Model
{
    
    const tabla='presupuestos';
    const id_tabla = 'id_cirugia';

    function insert($row = array())
    {

        $this->db->insert(self::tabla, $row);
        return $this->db->insert_id();
    }

    function find($id)
    {
        $query = sprintf("select * from %s where %s=%s",  self::tabla,  self::id_tabla, $ids);
        $row = $this->db->query($query);
        return $row;
    }

    function select()
    {
        $query = sprintf("select * from %s",self::tabla);
        $rows = $this->db->query($query);
        $rows = $rows->result_array();
        return $rows;
    }

    function update($id, $row = array())
    {
        $this->db->where(self::id_tabla, $id);
        $this->db->update(self::tabla, $row);
    }

    function delete($id)
    {
        $query = sprintf("delete from %s where %s=%s",self::tabla,self::id_tabla,$id);
        $this->db->query($query);
    }

}

?>